package com.hqq.behaviour.strategy;

/**
 * DragonSlayer
 * 环境角色：持有一个策略类的引用，最终给客户端调用。
 * Created by heqianqian on 2017/6/19.
 */
public class DragonSlayer {

    private DragonSlayingStrategy dragonSlayingStrategy;

    public DragonSlayer(DragonSlayingStrategy dragonSlayingStrategy) {
        this.dragonSlayingStrategy = dragonSlayingStrategy;
    }

    public void changeStrategy(DragonSlayingStrategy dragonSlayingStrategy) {
        this.dragonSlayingStrategy = dragonSlayingStrategy;
    }

    public void goToBattle() {
        dragonSlayingStrategy.execute();
    }

}
